package com.example.demo.thread;


import cn.hutool.core.io.file.FileWriter;

import java.util.concurrent.*;

/**
 * @author chenchao
 * @desc
 * @date 2022/2/15 15:17
 */
public class Promisor {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        FutureTask<Integer> task = new FutureTask(()->{
            System.out.println("执行完了");
            Thread.sleep(2000L);
            return 1;
        });
        new Thread(task).start();
        if(!task.isDone()){
            System.out.println("没有执行完");
        }




    }
}
